/*
 * SunSpotHostApplication.java
 *
 * Created on 2012/10/31 0:42:01;
 */

package baseapp;

import com.sun.spot.peripheral.radio.RadioFactory;
import com.sun.spot.peripheral.radio.IRadioPolicyManager;
import com.sun.spot.io.j2me.radiostream.*;
import com.sun.spot.io.j2me.radiogram.*;
import com.sun.spot.util.IEEEAddress;
import corelayer.CoreLayer;
import corelayer.Message;

import java.io.*;
import javax.microedition.io.*;


/**
 * Sample Sun SPOT host application
 */
public class SunSpotHostApplication {

    /**
     * Print out our radio address.
     */
    public void run() {
        BaseStation base = new BaseStation();
        CoreLayer core = new CoreLayer(base);
        Message msg = new Message("foobar@hoge.com", "bar@fuga.jp", "Hello world");
        core.send(msg);
        
        
        long ourAddr = RadioFactory.getRadioPolicyManager().getIEEEAddress();
        System.out.println("Our radio address = " + IEEEAddress.toDottedHex(ourAddr));
        System.exit(0);
    }

    /**
     * Start up the host application.
     *
     * @param args any command line arguments
     */
    public static void main(String[] args) {
        SunSpotHostApplication app = new SunSpotHostApplication();
        app.run();
    }
}
